package kneipe.kneipenbereiche;

import java.util.LinkedList;
import java.util.List;

import javax.swing.JPanel;

import kneipe.IArea;
import kneipe.Kneipe;
import kneipe.Seat;

public class Kneipenbereich<T> extends JPanel implements IArea<T> {
	private static final long serialVersionUID = 1L;
	private List<Seat> seats;
	private String areaName;
	private Kneipe kneipe;

	public Kneipenbereich(String name, List<Seat> seats, Kneipe kneipe) {
		this.setAreaName(name);
		this.setSeats(seats);
		this.setKneipe(kneipe);
		for (Seat seat : seats) {
			this.add(seat);
		}
	}

	public Kneipenbereich() {
		this("Unbekannter Bereich", null, null);
	}

	public Kneipenbereich(String name, Kneipe kneipe) {
		this(name, new LinkedList<Seat>(), kneipe);
	}

	@Override
	public List<Seat> getSeats() {
		return this.seats;
	}

	@Override
	public void setSeats(List<Seat> seats) {
		this.seats = seats;
	}

	@Override
	public String getAreaName() {
		return areaName;
	}

	@Override
	public void setAreaName(String areaName) {
		this.areaName = areaName;
	}

	@Override
	public Kneipe getKneipe() {
		return kneipe;
	}

	@Override
	public void setKneipe(Kneipe kneipe) {
		this.kneipe = kneipe;
	}

	public void addSeat(Seat seat) {
		this.add(seat);
		this.seats.add(seat);
	}

	@Override
	public String toString() {
		return areaName + "beinhaltet: " + getSeats().toString();
	}

}
